"""介绍locals和globals"""
from pprint import pprint as pp
a=1

pp({'locals:':locals(),'globals':globals()})

def f():
    a=2
    print("打印函数内变量a%s"%(a))
    pp({'locals:': locals(), 'globals': globals()})

class C:
    a=3
    print("打印类变量a%s"%(a))
    pp({'locals:': locals(), 'globals': globals()})

f()

print("最后打印全局变量a%s"%(a))